Optimal. Leaf size=119 \[ \frac {\sin ^2(c+d x) \left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right )}{2 d}+\frac {1}{2} x \left (a^4+6 a^2 b^2-3 b^4\right )-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {b^4 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.18, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3088, 1805, 1802, 635, 203, 260} \[ \frac {\sin ^2(c+d x) \left (\left (-6 a^2 b^2+a^4+b^4\right ) \cot (c+d x)+4 a b \left (a^2-b^2\right )\right )}{2 d}+\frac {1}{2} x \left (6 a^2 b^2+a^4-3 b^4\right )-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {b^4 \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 203
Rule 260
Rule 635
Rule 1802
Rule 1805
Rule 3088
Rubi steps
\begin {align*} \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx &=-\frac {\operatorname {Subst}\left (\int \frac {(b+a x)^4}{x^2 \left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\operatorname {Subst}\left (\int \frac {-2 b^4-8 a b^3 x-\left (a^4+6 a^2 b^2-b^4\right ) x^2}{x^2 \left (1+x^2\right )} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\operatorname {Subst}\left (\int \left (-\frac {2 b^4}{x^2}-\frac {8 a b^3}{x}+\frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2}\right ) \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\operatorname {Subst}\left (\int \frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\left (4 a b^3\right ) \operatorname {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}-\frac {\left (a^4+6 a^2 b^2-3 b^4\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 6.26, size = 477, normalized size = 4.01 \[ \frac {b^3 \left (\frac {\cos ^2(c+d x) (a+b \tan (c+d x))^5 \left (a b \tan (c+d x)+b^2\right )}{2 b^4 \left (a^2+b^2\right )}-\frac {\left (3 b^2-5 a^2\right ) \left (b \left (6 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} \left (\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}+4 a (a-b) (a+b)\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (4 a (a-b) (a+b)-\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+2 a b^2 \tan ^2(c+d x)+\frac {1}{3} b^3 \tan ^3(c+d x)\right )+4 a \left (\frac {1}{2} b^2 \left (10 a^2-b^2\right ) \tan ^2(c+d x)+5 a b \left (2 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} \left (5 a^4-10 a^2 b^2+\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}+b^4\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (5 a^4-10 a^2 b^2-\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}+b^4\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+\frac {5}{3} a b^3 \tan ^3(c+d x)+\frac {1}{4} b^4 \tan ^4(c+d x)\right )}{2 b^2 \left (a^2+b^2\right )}\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.83, size = 136, normalized size = 1.14 \[ -\frac {8 \, a b^{3} \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + 4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right )^{3} - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} d x\right )} \cos \left (d x + c\right ) - {\left (2 \, b^{4} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 3.52, size = 128, normalized size = 1.08 \[ \frac {4 \, a b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, b^{4} \tan \left (d x + c\right ) + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} {\left (d x + c\right )} - \frac {4 \, a b^{3} \tan \left (d x + c\right )^{2} - a^{4} \tan \left (d x + c\right ) + 6 \, a^{2} b^{2} \tan \left (d x + c\right ) - b^{4} \tan \left (d x + c\right ) + 4 \, a^{3} b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 52.30, size = 210, normalized size = 1.76 \[ \frac {a^{4} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{2 d}+\frac {a^{4} x}{2}+\frac {a^{4} c}{2 d}-\frac {2 \left (\cos ^{2}\left (d x +c \right )\right ) a^{3} b}{d}-\frac {3 a^{2} b^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{d}+3 a^{2} b^{2} x +\frac {3 a^{2} b^{2} c}{d}-\frac {2 a \,b^{3} \left (\sin ^{2}\left (d x +c \right )\right )}{d}-\frac {4 a \,b^{3} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {b^{4} \left (\sin ^{5}\left (d x +c \right )\right )}{d \cos \left (d x +c \right )}+\frac {b^{4} \cos \left (d x +c \right ) \left (\sin ^{3}\left (d x +c \right )\right )}{d}+\frac {3 b^{4} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{2 d}-\frac {3 b^{4} x}{2}-\frac {3 b^{4} c}{2 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.44, size = 135, normalized size = 1.13 \[ \frac {8 \, a^{3} b \sin \left (d x + c\right )^{2} + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{4} + 6 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} b^{2} - 8 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} a b^{3} - 2 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} b^{4}}{4 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.23, size = 255, normalized size = 2.14 \[ \frac {a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-3\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+4\,a\,b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )+6\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-4\,a\,b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )}{d}+\frac {\frac {a^4\,\sin \left (c+d\,x\right )}{8}+\frac {9\,b^4\,\sin \left (c+d\,x\right )}{8}+\frac {a^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {b^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {a\,b^3\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {a^3\,b\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {3\,a^2\,b^2\,\sin \left (c+d\,x\right )}{4}-\frac {3\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}}{d\,\cos \left (c+d\,x\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________